﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Gnosis.Babel;
using Gnosis.SQLite.Clauses;

namespace Gnosis.SQLite
{
    public class ColumnName
        : Value, IColumnName
    {
        public ColumnName(string name)
            : base(name)
        {
        }

        protected ColumnName(string infix, IValue value, TextLiteral alias)
            : base(infix, value, alias)
        {
        }

        public static readonly IColumnName All = new ColumnName("*");

        public static IColumnName AllIn(string alias)
        {
            return new ColumnName(string.Format("{0}.*", alias));
        }

        #region IColumnName Members

        public IOrderingTerm Ascending()
        {
            return new OrderingTerm(this, Direction.Ascending);
        }

        public IOrderingTerm Descending()
        {
            return new OrderingTerm(this, Direction.Descending);
        }

        public IColumnAssignment SetTo(IValue value)
        {
            return new ColumnAssignment(this, value);
        }

        #endregion
    }
}
